<!--没有连接-->
<template>
  <div class="student-detail-view">
    <div class="detail-header">
      <h2 class="title">学生详细信息</h2>
      <button class="back-button" @click="goBackToStudents">
        <i class="fa-solid fa-arrow-left"></i> 返回学生列表
      </button>
    </div>
    <div class="student-detail-card">
      <div class="detail-section">
        <h3 class="section-title">基本信息</h3>
        <div class="detail-grid">
          <div class="detail-item">
            <span class="detail-label">学号：</span>
            <span class="detail-value">{{ currentStudent.studentId }}</span>
          </div>
          <div class="detail-item">
            <span class="detail-label">姓名：</span>
            <span class="detail-value">{{ currentStudent.name }}</span>
          </div>
          <div class="detail-item">
            <span class="detail-label">性别：</span>
            <span class="detail-value">{{ currentStudent.gender }}</span>
          </div>
          <div class="detail-item">
            <span class="detail-label">班级：</span>
            <span class="detail-value">{{ selectedClass.className }}</span>
          </div>
        </div>
      </div>
      <div class="detail-section">
        <h3 class="section-title">联系方式</h3>
        <div class="detail-grid">
          <div class="detail-item">
            <span class="detail-label">手机：</span>
            <span class="detail-value">{{ currentStudent.phone }}</span>
          </div>
          <div class="detail-item">
            <span class="detail-label">邮箱：</span>
            <span class="detail-value">{{ currentStudent.email }}</span>
          </div>
        </div>
      </div>
      <div class="detail-section">
        <h3 class="section-title">其他信息</h3>
        <div class="detail-grid">
          <div class="detail-item">
            <span class="detail-label">入学时间：</span>
            <span class="detail-value">{{ currentStudent.enrollmentDate }}</span>
          </div>
          <div class="detail-item">
            <span class="detail-label">宿舍：</span>
            <span class="detail-value">{{ currentStudent.dormitory }}</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue';

const props = defineProps({
  currentStudent: {
    type: Object,
    default: () => ({
      id: null,
      studentId: '',
      name: '',
      gender: '',
      phone: '',
      email: '',
      enrollmentDate: '',
      dormitory: '',
      classId: null
    })
  },
  selectedClass: {
    type: Object,
    default: () => ({
      id: null,
      className: '',
      classCode: '',
      major: '',
      grade: '',
      studentCount: 0
    })
  }
});

const emit = defineEmits(['goBackToStudents']);

const goBackToStudents = () => {
  emit('goBackToStudents');
};
</script>

<style scoped>
.student-detail-view {
  padding: 2rem;
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 1rem;
}

.title {
  color: #931a6a;
  font-size: 1.875rem;
  font-weight: 600;
}

.back-button {
  background-color: #f3f4f6;
  color: #374151;
  padding: 0.75rem 1.5rem;
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background-color 0.3s ease;
}

.back-button:hover {
  background-color: #e5e7eb;
}

.student-detail-card {
  background-color: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  padding: 2rem;
}

.detail-section {
  margin-bottom: 2rem;
}

.section-title {
  color: #931a6a;
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  border-bottom: 1px dashed #e5e7eb;
  padding-bottom: 0.5rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.detail-item {
  background-color: #f9fafb;
  border-radius: 0.375rem;
  padding: 1rem;
  display: flex;
  align-items: center;
  transition: transform 0.3s ease;
}

.detail-item:hover {
  transform: translateY(-3px);
}

.detail-label {
  font-weight: 600;
  color: #374151;
  margin-right: 1rem;
  min-width: 80px;
}

.detail-value {
  color: #6b7280;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .student-detail-view {
    padding: 1.5rem;
    width: 95%;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .back-button {
    padding: 0.5rem 1rem;
  }
}
</style>    